<template>
    <div>
        <cityheader></cityheader> 
        <seader :aases="aases"></seader>
        <list :aases="aases" :bbses="bbses"
            :les="les" ></list>  
        <alphabet 
            :aases="aases"
            @change="handlechang"
        ></alphabet>
    </div>
</template>

<script>
// import axios  from 'axios'
import cityheader from './components/header'
import seader from './components/seader'
import list from './components/list'
import alphabet from './components/alphabet'
import axios from 'axios'

export default {
    name:'city',
    components: {
        cityheader,
        seader,
        list,
        alphabet
    },
    data(){
        return {
            aases:{}, //热门城市
            bbses:[],  //字母表城市
            les:""
        }
    },
    methods:{ 
        getcityinfo () {
           axios.get('/static/mock/city.json')
           .then(this.handlecityfo)
        },
        handlecityfo (res) {
            res=res.data
            if(res.ret&&res.data){
                const data=res.data
                this.aases=data.cities
                this.bbses=data.hotCities
            }
        },
        handlechang(les){
            this.les=les //alphabet 传递过来的点击参数
            console.log("les"+les)
        }
    },
    mounted () {
        this.getcityinfo()
    }
}
</script>

<style lang="stylus" scoped>

</style>



